<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/WEB-INF/layout/t.xhtml">
	<ui:define name="bundle">
		<f:loadBundle basename="base" var="msg" />
	</ui:define>
	<ui:define name="title">
		<h:outputText value="#{msg['template.module.list.title']}" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="template" />
	</ui:define>
	<ui:define name="content">
		<h:form id="central">
			<center>
				<p:panel header="#{msg['template.module.list.title']}">
					<h:panelGrid columns="5" rendered="true">

						<h:outputLabel for="nome" value="#{msg['template.search.name']}" />
						<h:inputText id="nome"
							value="#{templateController.search.obj.name}" />

						<h:outputLabel for="tipo" value="#{msg['template.search.type']}" />
						<h:selectOneMenu id="tipo"
							value="#{templateController.search.obj.searchStatico}"
							style="width: 400px;">
							<f:selectItems value="#{staticoDinamicoItems}" />
						</h:selectOneMenu>
						<p:commandButton action="#{templateController.reloadAjax}"
							value="#{msg['global.search']}" ajax="true" immediate="false"
							update="templatesList" />

					</h:panelGrid>
					<br />

					<p:dataTable id="templatesList" rowIndexVar="rowIndex" var="t"
						value="#{templateController.model}"
						rows="#{templateController.pageSize}" paginator="true"
						dynamic="true">
						<p:column width="50">
							<center>
								<h:outputText value="#{rowIndex+1} " />
							</center>
						</p:column>
						<p:column width="400">
							<f:facet name="header">
								<h:outputText value="#{msg['template.list.name']}" />
							</f:facet>
							<h:outputText value="#{t.name}" />
						</p:column>
						<p:column width="50">
							<f:facet name="header">
								<h:outputText value="#{msg['template.list.type']}" />
							</f:facet>
							<h:outputText value="statico" rendered="#{t.statico}" />
							<h:outputText value="dinamico" rendered="#{not t.statico}" />
						</p:column>
						<p:column width="200">
							<f:facet name="header">
								<h:outputText value="#{msg['global.operations']}" />
							</f:facet>
							<center>
								<h:commandLink value="#{msg['global.view']}"
									action="#{templateController.viewElement}" />
								-
								<h:commandLink value="#{msg['global.edit']}"
									action="#{templateController.modElement}" />
								-
								<h:commandLink value="#{msg['global.clone']}"
									action="#{templateController.cloneElement}" />
							</center>
						</p:column>
					</p:dataTable>
				</p:panel>
				<br /> <br />

				<h:panelGrid columns="2">
					<h:commandButton action="#{templateController.addElement}"
						value="#{msg['global.add']}" />
					<h:commandButton action="#{templateController.backPage}"
						value="#{msg['global.back']}" rendered="true" />
				</h:panelGrid>
			</center>

		</h:form>

	</ui:define>
</ui:composition>